<%@ page language="java" import="java.util.*" pageEncoding="utf8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>深圳市橄榄树助飞基金-企业登记</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<script>
var Checking = {};
Checking = {

        $ : function(id) {
 return document.getElementById(id);
 },

 color : ['#FF0000', '#00FF66', '#FFFF00', '#FFCC00', '#6600FF', '#0000FF','#99FFFF', '#66CCFF'],
 cacheValue : null,// 缓存画布上的值,比对时用

 draw : function() {
  var div = this.$('ieContainer'), sty = div.style;
  div.onselectstart = new Function("return false");// 禁止选中
  div.oncopy = new Function("return false");// 禁止复制

  sty.height = "30px";
  sty.width = "125px";
  var bgColor = this.getRandomColor();// div背景色
  sty.backgroundColor = bgColor;
  sty.font = "26pt Kristen ITC";  //Calibri
  var fontColor = this.getRandomColor();// 文字颜色
  sty.color = bgColor == fontColor ? this.getRandomColor() : fontColor;// 保证文字色基本不会跟背景色一样
  sty.textAlign = "center";
  // 设置div颜色渐变效果
  sty.filter = "progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr= "
    + bgColor + ", EndColorStr= " + this.getRandomColor() + ")";
  var newText = this.getRandomDigit_Letters(5);
  this['cacheValue'] = newText;// 临时存贮生成的验证码，校验时使用
  div.innerHTML = newText;
 },
  //画背景
  //createLinearGradient() 方法创建一条线性颜色渐变。返回一个线性颜色渐变的一个 CanvasGradient对象。
 drawBgColor : function(context) {
  var grd = context.createLinearGradient(100, 100, 70, 18);
  var startColor = this.getRandomColor();
  var endColor = this.getRandomColor();
  grd.addColorStop(0, startColor);
  grd.addColorStop(1, startColor == endColor
      ? this.getRandomColor()
      : endColor);
  context.fillStyle = grd;
  context.fillRect(100,100, 800, 600);
 },

 //画文字
 drawText : function(context) {
  var x = 60;
  var y = 30;
  context.font = "30pt Kristen ITC";
  context.textAlign = "center";
  context.fillStyle = this.getRandomColor();
  var newText = this.getRandomDigit_Letters(5);
  this['cacheValue'] = newText;
  context.fillText(newText, x, y);
 },

 //获得随机颜色
 getRandomColor : function() {
  var len = this.color.length, random = this.getBigRandom(len);
  return this['color'][random];
 },

 //根据scale以内的随机整数
 getBigRandom : function(scale) {
  return Math.floor(Math.random() * (scale || 10));
 },

 //获得画布上的字符串,字母与数字的随机组合
 getRandomDigit_Letters : function(length) {
  var result = [];
  var arr = this.getLetters().concat(this.getDigit());
  for (var i = 0; i < length; i++) {
   result.push(arr[this.getBigRandom(35)]);
  }
  return result.join("");

 },

 //获得0～9的数组
        getDigit : function() {
  var arr = [];
  for (var i = 0; i < 10; i++) {
   arr.push(i);
  }
  return arr;
 },

 //获得a～z的字母数组
 getLetters : function() {
  var arr = [];
  var start = "a".charCodeAt();
  var end = "z".charCodeAt();

  for (var i = start; i <= end; i++) {
   if (i % 2 == 0) {
    arr.push(String.fromCharCode(i));
   } else {
    arr.push(String.fromCharCode(i).toUpperCase());
   }

  }
  return arr;
 },

 // 判断
 check : function() 

 {
  var chkValue = this['cacheValue'].toUpperCase();
  var inputValue = this.$('chk').value.toUpperCase();
                 if (chkValue !== inputValue)
                {     
                      alert("验证码输入错误！");
                      return false;                      
                 }
                else
                     return true;             
 }
}
function Juge(theForm)
{	             
                   if(document.getElementById("name").value == "")
                 {
                      alert("企业名不能为空!")
                      document.getElementById("name").focus();
                      return false;
                  }
          
                  
            if(document.getElementById("linkman").value == "")
                 {
                      alert("联系人不能为空!")
                      document.getElementById("linkman").focus();
                      return false;
                  }
            if(document.getElementById("phone").value == "")
                 {
                      alert("电话不能为空！")
                      document.getElementById("phone").focus();
                      return false;
                  }
            if(document.getElementById("address").value == "")
                 {
                      alert("地址不能为空！")
                      document.getElementById("address").focus();
                      return false;
                  }   
             if(document.getElementById("email").value == "")
                 {
                      alert("邮箱不能为空!")
                      document.getElementById("email").focus();
                      return false;
                  }
                  var reg=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
                 
               if(!reg.test(document.getElementById("email").value)){
                  	 alert("邮箱格式错误!")
                      document.getElementById("email").focus();
                      return false;	
                  	}   
        var a=Checking.check();
        if(a)
            return true;
        else
         {  
             document.getElementById("chk").focus();
         	 document.getElementById("chk").value="";
          Checking.draw();
            return false;
         }
}       
</script>
</head>

<body onLoad="Checking.draw()">
<div class="head">
	<div class="top">
		<div class="logo"><img src="images/logo.jpg" /></div>
		<div class="topmenu">
			<a href="#">关于我们</a> |
			<a href="#">加入收藏</a> |
			<a href="#">设为首页</a>
		</div>
	</div>
	<div class="menu">
	
		<div class="main">
			<ul>
				<li><a href="index.jsp">首页</a></li>
				<li><a href="aboutus.jsp">关于我们</a></li>
				<li><a href="fengcaiServlet">残友风彩</a></li>
				<li><a href="#">论坛</a></li>
				<li><a href="lovesInfo.jsp">爱心企业与个人</a></li>
				<li class="bgnone"><a href="registration.jsp">我要参与</a></li>
			</ul>
		</div>
	
	</div>
	
	<div class="banner">
		<img src="images/banner.jpg" />
	</div>
</div>
<div class="aboutus">
	<div class="p140">
		<img src="images/reg04.jpg" />
	</div>
    <form method="post" onSubmit="return Juge(PostTopic)" name="PostTopic" id="PostTopic" action ="companyServlet?action=signIn" >
	<div class="reg01">
		<div class="fl"><span class="redfont">*</span> 企业名称： 
		  <input type="text" name="name" id="name"/> <span class="font999">填写您企业的全称</span></div>
		<div class="fl"><span class="redfont">*</span> 联 系 人 ：
		  <input type="text" name="linkman" id="linkman"/></div>
		<div class="fl"><span class="redfont">*</span> 联系电话 ：
		  <input type="text" name="phone" id="phone"/> 
		  <span class="font999">如果是固定电话请填写区号，格式：0755-88888888</span></div>
		<div class="fl"><span class="redfont">*</span> 企业地址： 
		  <input type="text" name="address" id="address"/> 
		  <span class="font999">请填写详细的企业地址：xxxxx路xxx号</span></div> 
	    <div class="fl"><span class="redfont">*</span> 电子邮箱：
		  <input type="text" name="email" id="email"/>
		</div>
		<div class="fl"><span class="redfont"></span> 备注：
		  <textarea rows="10" cols="50" name="remark" id="remark"></textarea>
		</div>
	  <div class="fl"><span class="redfont">*</span> 验 证 码: 
	<input type="text"  name="chk" id="chk" style="width:50px;"/>
	<div  id="ieContainer" onDblClick="Checking.init()"> </div>
 	<span class="font999">输入图片中的字符</span></div>
		<div class="fl"><button><img src="images/b01.jpg" /></button></div>
	</div>
    </form>
    </div>
    
</div>

<div class="footer">
	深圳市橄榄树助飞基金<br>
	地址：深圳市罗湖区宝安南路3097号洪涛大厦四楼<br>
	电话：0755-25595903、25590786 传真：25595900<br>
	Copyright &copy; 2011 www.glszhufei.com , All Rights Reserved.
</div>
</body>
</html>


